from django.db import models

# 基类表
class Base(models.Model):
    id = models.AutoField(primary_key=True)

    class Meta:
        abstract = True

class Cate(Base):
    cname = models.CharField(max_length=100)

    class Meta:
        db_table = 'cate'


# 商品表
class Goods(Base):
    # 名称
    name = models.CharField(max_length=200)
    # 商品描述
    desc = models.CharField(max_length=500)
    # 商品图片
    img = models.CharField(max_length=200)
    # 商品类别
    cid = models.IntegerField()
    # 演示视频
    video = models.CharField(max_length=200)
    # 关注
    flow = models.IntegerField(default=0,null=True)
    # 价格
    price = models.IntegerField()
    # 商品规格
    param = models.CharField(max_length=500)

    class Meta:
        db_table = 'goods'


# 用户表
class User(Base):

    # 用户名
    username = models.CharField(max_length=200)

    # 密码
    password = models.CharField(max_length=200)

    # 头像
    img = models.CharField(max_length=200)

    # 用户级别    0普通  1管理员  2商家
    type = models.IntegerField()
    
    class Meta:
        db_table = 'user'








